<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>2使用Vue.js实现TodoList</title>
    <script src="./vue.js"></script>
</head>

<body>
    <div id="app">
        <input type="text" v-model="inputValue">
        <button v-on:click='handleBtn'>提交</button>
        <ul>
            <li v-for="item in list">{{item}}</li>
        </ul>
    </div>
    <script>
        var app = new Vue({
            el: '#app',
            data: {
                list: ['第一颗的内容', '第二颗的内容'],
                inputValue: ''
            },
            methods: {
                handleBtn() {
                    console.log(app.$data.inputValue);
                    console.log(this.inputValue);
                    this.list.push(app.$data.inputValue)
                    this.inputValue = ''

                }
            },
        })
    </script>
</body>

</html>